package com.chenxiao.field.fielddemo.aspect;

import com.alibaba.druid.support.json.JSONUtils;
import com.chenxiao.field.fielddemo.anno.MyCustomAnnotation;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;
/**
 * @Author: CX
 * @Date: Created in  2023/12/06 17:53
 * @version: v1.0
 * @Description: TODO
 **/


@Aspect
public class MyAnnotationAspect {

    @Before("@annotation(myCustomAnnotation)") // 在方法执行之前应用切面
    public void beforeAdvice(MyCustomAnnotation myCustomAnnotation) {
        // 执行你的逻辑，比如修改字段值
        System.out.println(JSONUtils.toJSONString(myCustomAnnotation));
        System.out.println("打印开始");
    }
}
